package com.ruoyi.yljf.controller.AppController;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.BaseQueryPage;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.security.annotation.Anonymous;
import com.ruoyi.yljf.domain.Goods;
import com.ruoyi.yljf.domain.vo.UserScoreRecordVO;
import com.ruoyi.yljf.domain.vo.UserVO;
import com.ruoyi.yljf.service.IGoodsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RequestMapping("/api/score")
@RestController
public class ApiScoreController extends BaseController {
    @Resource
    private IGoodsService goodsService;

    /**
     * 查询积分记录
     * //TODO 待完善   张文
     */
    @Anonymous
    @GetMapping("/scoreDetails")
    public TableDataInfo scoreDetails(BaseQueryPage queryPage) {
        startPage();
        //查询用户积分明细  判断用户是否登录 ，未登录返回空列表
        List<UserScoreRecordVO> list = new ArrayList<>();
        return getDataTable(list);
    }

    /**
     * 查询积分商城
     */
    @Anonymous
    @GetMapping("/scoreMall")
    public TableDataInfo scoreMall(BaseQueryPage queryPage) {
        startPage();
        List<Goods> goods = goodsService.list();
        return getDataTable(goods);
    }

    /**
     * 排行榜
     * //TODO 排行榜
     */
    @Anonymous
    @GetMapping("/rankList")
    public TableDataInfo rankList( ) {
        //查询用户总榜前十
        List<UserVO> list = new ArrayList<>();
        return getDataTable(list);
    }
}
